<?PHP

	class tpl_managesmilies {
		
		public static function managesmilies(){
		
			$smilies = '';
			$class = 'td2';
			foreach($GLOBALS['OUTPUT']->smilies as $w=>$r){
				$link = base64_encode($w);
				$w = stripslashes($w);
				
				$smilies .= <<<EOV
<tr>
	<td class='$class' width='40%'>$w</td>
	<td class='$class' width='40%'>$r</td>
	<td class='$class' width='20%'><a href='./index.php?act=admin&page=managesmilies{$GLOBALS['OUTPUT']->ses}&delete_smiley=$link'>[{$GLOBALS['LANG']->lang_admin->delete}]</a></td>
</tr>
EOV;
				$class = ($class == 'td2' ? 'td1' : 'td2');
			}
			
			if(empty($smilies)){
				$smilies = <<<EOV
<tr>
	<td class='td2' colspan='3' style='text-align: center; font-style: italic'>{$GLOBALS['LANG']->lang_admin->nosmilies}</td>
</tr>
EOV;
			}
			
			$unused = '';
			$class = 'td2';
			foreach($GLOBALS['OUTPUT']->unused as $w=>$r){
				$link = base64_encode($r);
				
				$unused .= <<<EOV
<tr>
	<td class='$class' width='40%'>
EOV
.
				tpl_form::text_password_file('text','smiley['.base64_encode($r).']') .
				<<<EOV
	</td>
	<td class='$class' width='40%'><img src='./smilies/$r' /></td>
	<td class='$class' width='20%'><a href='./index.php?act=admin&page=managesmilies{$GLOBALS['OUTPUT']->ses}&delete_file=$link'>[{$GLOBALS['LANG']->lang_admin->delete}]</a></td>
</tr>
EOV;
				$class = ($class == 'td2' ? 'td1' : 'td2');
			}
			
			if(empty($unused)){
				$unused = <<<EOV
<tr>
	<td class='td2' colspan='3' style='text-align: center; font-style: italic'>{$GLOBALS['LANG']->lang_admin->nounusedsmilies}</td>
</tr>
EOV;
			}
			
			return	tpl_globals::header() .
					<<<EOV
	<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->managesmilies}</div>
	<table style='width: 100%;' cellspacing='1' cellpadding='5'>
		<tr>
			<td class='table_header_row' width='40%'>{$GLOBALS['LANG']->lang_admin->smileycode}</td>
			<td class='table_header_row' width='40%'>{$GLOBALS['LANG']->lang_admin->smiley}</td>
			<td class='table_header_row' width='20%'>{$GLOBALS['LANG']->lang_admin->action}</td>
		</tr>
		{$smilies}
	</table>
	
	<br />
	
	<form action='./index.php?act=admin{$GLOBALS['OUTPUT']->ses}&page=managesmilies' method='post'>
		
		<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->inactive_smilies}</div>
		<table style='width: 100%;' cellspacing='1' cellpadding='5'>
			<tr>
				<td class='table_header_row' width='40%'>{$GLOBALS['LANG']->lang_admin->smileycode}</td>
				<td class='table_header_row' width='40%'>{$GLOBALS['LANG']->lang_admin->smiley}</td>
				<td class='table_header_row' width='20%'>{$GLOBALS['LANG']->lang_admin->action}</td>
			</tr>
			{$unused}
			<tr>
				<td class='table_header_row' colspan='3' style='text-align: center'><input class='form_button_norm' onmouseout="this.className=this.className.replace('_over','_norm');" onmouseover="this.className=this.className.replace('_norm','_over');" type='submit' value='{$GLOBALS['LANG']->lang_formcommon->submit}' /></td>
			</tr>
		</table>
		
		<br />
		
	</form>
	<form action='./index.php?act=admin{$GLOBALS['OUTPUT']->ses}&page=managesmilies' method='post' enctype="multipart/form-data">
		
		<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->addsmiley}</div>
		<table style='width: 100%;' cellspacing='1' cellpadding='5'>
			<tr>
				<td class='td2'>
					{$GLOBALS['LANG']->lang_admin->smiley}
				</td>
				<td class='td2'>
EOV
.
					tpl_form::text_password_file('file','uloadsmilies',$GLOBALS['LANG']->lang_admin->smiley_file_desc) .
					<<<EOV
				</td>
			</tr>
			<tr>
				<td class='table_header_row' colspan='2' style='text-align: center'><input class='form_button_norm' onmouseout="this.className=this.className.replace('_over','_norm');" onmouseover="this.className=this.className.replace('_norm','_over');" type='submit' value='{$GLOBALS['LANG']->lang_formcommon->submit}' /></td>
			</tr>
		</table>
	</form>
EOV
.
			tpl_globals::footer();
				
		}
		
	}

?>